import http from '@/plugins/axios'

export function getCustomerStatistics(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/customerStatistics',
    data
  })
}

export function getLossCustomerStatistics(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/lossCustomerStatistics',
    data
  }).then(res => {
    const data = res || []
    const list = data.map(item => {
      const keys = Object.keys(item)
      const key = keys[0]
      return {
        label: key,
        value: item[key]
      }
    })
    return {
      list: list,
      totalCount: 0
    }
  })
}

export function getAddCustomerStatistics(data) {
  return http({
    method: 'POST',
    url: '/ykf/customer/addCustomerStatistics',
    data
  }).then(res => {
    const data = res || []
    const list = data.map(item => {
      const keys = Object.keys(item)
      const key = keys[0]
      return {
        label: key,
        value: item[key]
      }
    })
    return {
      list: list,
      totalCount: 0
    }
  })
}

export function getStatistics1(data) {
  return http({
    method: 'POST',
    url: '/ykf/statistics/statistics1',
    data
  })
}

export function getStatistics2(data) {
  return http({
    method: 'POST',
    url: '/ykf/statistics/statistics2',
    data
  })
}

export function getStatistics3(data) {
  return http({
    method: 'POST',
    url: '/ykf/statistics/statistics3',
    data
  })
}

export function getStatistics4(data) {
  return http({
    method: 'POST',
    url: '/ykf/statistics/statistics4',
    data
  })
}

export function getStatistics5(data) {
  return http({
    method: 'POST',
    url: '/ykf/statistics/statistics5',
    data
  })
}
